<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<script type="text/javascript" language="javascript">
<!--
function add_type_info(ct_name)
{
	if(!ct_name)
	{
		alert("Data is empty.");
	}
	else
	{
		$("#stat").css({"display":"block"});
		$("#stat").html("正在保存内容......");
		_ajax_request('check',
				'doAddItemType',
				{
					name: ct_name
				},
				on_success,
				on_failure);
	}
}

function add_checkitem_info(thisForm)
{
	$("#stat").css({"display":"block"});
	$("#stat").html("正在保存内容......");
	_ajax_submit(thisForm, on_success, on_failure);
	return false;
}


function on_success(response)
{
	response1 = eval("("+response+")");
	var stat = document.getElementById("stat");
	if(response1.result == 'ok')
	{
		alert(response1.sucmsg);
		stat.innerHTML = "OK，正在重定向......";
		reloadPage();
	}
	else if(response1.result == 'error')
	{
		stat.innerHTML = response1.errmsg;
	}
}

function on_failure(response)
{
	var stat = document.getElementById("stat");
	stat.innerHTML = response;
}
-->
</script>
<style type='text/css'>
table {
	margin-top:20px;
}
table td {
	text-align:left;
}
</style>
<div id="stat" style="display:none;"></div>
<form action="index.php" method="post" onsubmit="javascript:return add_checkitem_info(this);">
<input type="hidden" name="_m" value="<?php echo $next_controller;?>"/>
<input type="hidden" name="_a" value="<?php echo $next_action;?>"/>
<table width="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#4c4c4c">
<tr>
<td>*检测项类别</td>
<td>
<select name="c_type">
<?php
if(empty($types))
{
	echo "<option value=''>-</option>";
}
else
{
	foreach($types as $v)
	{
		echo "<option value='{$v['ct_id']}'>{$v['ct_name']}</option>";
	}
}
?>
</select>
添加类别:&nbsp;<input id="ct_name" type="text" name="ct_name"/>&nbsp;<input type="button" onclick="add_type_info($('#ct_name').val());" value="添加"/>
</td>
</tr>
<tr>
<td>*检测项描述</td>
<td><textarea name="c_desc" cols="50" rows="20"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="新增"/></td>
<td><input type="reset" value="重置"/></td>
</tr>
</table>
</form>